<!DOCTYPE html>
<head>
    <title>Campeonato de Futbol</title>
</head>

<style type="text/css"> 
    body{ 
        background-image: url(fondo.jpg);
        background-size: cover;
        -moz-background-size: cover;
        -webkit-background-size: cover;
        -o-background-size: cover;
        background-position : center; 
        background-repeat : no-repeat; 
        background-attachment : fixed; 
    } 
</style> 
<body>
<option id="hm" value="home.php"></option>
<input type="button" onclick="document.location.href=document.getElementById('hm').value" value="Home">
</body>

<center>
<h1>Equipo con mayor afluencia de publico</h1>
</center>

<?php

$db = pg_connect("host=localhost dbname=boti user=no-jodas password=1234");

$query = "select P.nombre_del_club,P.publico_del_partido from partido as P
    where P.publico_del_partido >= all(select publico_del_partido 
                                        from partido)";

$result = pg_query($query);
$rows = pg_numrows($result);

echo '<center>';
echo '<table bgcolor=#A9E2F3 width = 300 border = 1>';
echo "\t\t<td><h2><center>Equipo</center></h2></td>\n";
echo "\t\t<td><h2><center>Publico</center></h2></td>\n";

for($i=1; $i<=$rows; $i++){

    $line = pg_fetch_array($result, null, PGSQL_ASSOC);
    echo '<tr>';
    echo "\t\t<td><h3><center>$line[nombre_del_club]</center></h3></td>\n";
    echo "\t\t<td><h3><center>$line[publico_del_partido]</center></h3></td>\n";
    echo '</tr>';

}
echo '</table>';
echo '</center>';

?>

